


import matplotlib.pyplot as plt
plt.rcParams["font.sans-serif"]=["SimHei"] #设置字体
plt.rcParams["axes.unicode_minus"]=False #该语句解决图像中的“-”负号的乱码问题


# Re-generate Burn-down and Burn-up for context
sprints = [1, 2, 3, 4]
total_hours = 1640
ideal_remaining = [total_hours - (total_hours/4) * i for i in [0,1,2,3,4]]
actual_remaining = [1640, 1240, 740, 340, 0]

fig, ax = plt.subplots()
ax.plot([0,1,2,3,4], ideal_remaining, linestyle='--', color='blue', label='理想剩余工时')
ax.plot([0,1,2,3,4], actual_remaining, marker='o', color='red', label='实际剩余工时')
ax.set_title('图3.1 在线考试系统燃尽图')
ax.set_xlabel('Sprint')
ax.set_ylabel('剩余工时 (人时)')
ax.set_xticks([0,1,2,3,4])
ax.legend()
plt.show()

ideal_completed = [(total_hours/4) * i for i in [0,1,2,3,4]]
actual_completed = [0, 400, 900, 1300, 1640]

fig2, ax2 = plt.subplots()
ax2.plot([0,1,2,3,4], ideal_completed, linestyle='--', color='blue', label='理想剩余工时')
ax2.plot([0,1,2,3,4], actual_completed, marker='o', color='red', label='实际剩余工时')
ax2.axhline(total_hours, linestyle=':', color='grey', label='总工时目标')
ax2.set_title('图3.2 在线考试系统燃起图')
ax2.set_xlabel('Sprint')
ax2.set_ylabel('已完成工时 (人时)')
ax2.set_xticks([0,1,2,3,4])
ax2.legend()
plt.show()
